<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>
        按钮
    </button>
    <div>
        <table>

        </table>
    </div>
</body>
<script>
    var arr = [
        { name: "zxy", age: 20, score: 89 },
        { name: "xhx", age: 21, score: 90 },
        { name: "xt", age: 23, score: 88 }
    ];
    var tab = document.querySelector('table');
    var btn = document.querySelector('button');
    var i =0;
    btn.onclick = function(){
        // 为表格创建行
        var tr = document.createElement('tr');
        tab.append(tr);
        // 创建名称数据
        var td = document.createElement('td');
        td.innerHTML = arr[i].name;
        // 将数据添加入行中
        tr.append(td);

        var td = document.createElement('td');
        td.innerHTML = arr[i].age;
        tr.append(td);

        var td = document.createElement('td');
        td.innerHTML = arr[i].score;
        tr.append(td);
        i++;
    }
</script>

</html>